package org.prem.collection.comparator;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class TestDogComparator {

	public static void main(String[] args){
		List<Dog> arlst = new ArrayList<Dog>();
		arlst.add(new Dog("Tommy",2));
		arlst.add(new Dog("Finny",8));
		arlst.add(new Dog("Jimmy",1));
		arlst.add(new Dog("Rocky",4));
		arlst.add(new Dog("Jockey",3));
		System.out.println("Before sorting");
		for(Dog d : arlst){
			System.out.println("Dog--->"+d.getName());
		}
		Collections.sort(arlst,new DogComparator());
		System.out.println("After sorting");
		for(Dog d : arlst){
			System.out.println("Dog--->"+d.getName());
		}
	}
}
